package com.ware4u.fx.news.vo;

import java.util.Date;

import com.ware4u.fx.news.entity.News;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@Schema(description = "新闻信息")
public class NewsVO {
	
	@Schema(description ="新闻编号", example="5")
	private Long id;
	
	@Schema(description ="新闻板块", example="政策法规")
	private String catalog;
	
	@Schema(description ="新闻标题", example="智慧城市建设新概念")
	private String title;
	
	@Schema(description ="新闻内容", example="<p>xx新闻</p>")
	private String content;
	
	@Schema(description ="新闻来源", example="xx网站")
	private String source;
	
	@Schema(description ="发布时间", example="2019/10/24")
	private Date publishTime;
	
	
	public NewsVO(News news) {
		this.id = news.getId();
		this.catalog = news.getCatalog();
		this.title = news.getTitle();
		this.source = news.getSource();
		if (news.getModifyTime() != null) {
			this.publishTime = news.getModifyTime();
		}
		else {
			this.publishTime = news.getCreateTime();
		}
	}
}
